use derive_builder::Builder;
use serde::{Deserialize, Serialize};

use crate::database::{DataSource, DatabaseType};
use crate::error::Error;

#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct ExtractFromDatabaseOption {}

#[derive(Debug, Default, Serialize, Deserialize, Clone, PartialEq)]
pub struct MetadataPackage {
    /// 数据库相关信息
    pub database: String,
}

#[async_trait::async_trait]
pub trait MetadataExtractor {
    /// 根据数据库获取到元数据
    async fn extract_from_database(
        &self,
        data_source: &DataSource,
        options: ExtractFromDatabaseOption,
    ) -> anyhow::Result<MetadataPackage>;
}
